﻿using StrokeCenterSystem.Code.Bll;
using StrokeCenterSystem.Core;
using StrokeCenterSystem.Utils;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;

namespace StrokeCenterSystem.Areas.StrokeCenter.Controllers
{
    public class InspectionReportController : BaseController
    {
        //
        // GET: /StrokeCenter/InspectionReport/
        /// <summary>
        /// 检查报告页面
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            return View();
        }

        public ContentResult Search()
        {
            string triageId = WebUtils.GetString("triageId");
            OperateResult result = InspectionReportManager.getCheckInfor(triageId);
            DataTable dt = new DataTable();
            if (result.Result == 1)
            {
                dt = JsonHelper.ToDataTable(result.Body.ToString());
                if (dt.Rows.Count > 0)
                {
                    dt = dt.AsEnumerable().Cast<DataRow>().OrderByDescending(p => p.Field<string>("ExamDate")).CopyToDataTable();
                }
            }
            var resultData = new { Rows = dt };
            return JsonDate(resultData);
        }
    }
}
